package com.cai.primeton.repository;

import com.cai.primeton.entity.PBook;
import com.cai.primeton.entity.PType;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.query.Param;

/**
 * @version 1.0
 * @author：蔡松坡
 * @date：2021/7/1 16 : 09
 * @package：com.cai.primeton.repository
 */
public interface CategoryRepo extends JpaRepository<PType,Integer> {

    @Query("select t.name from ptype t , pbook b WHERE t.id=b.type AND b.name = :name")
    String findType(@Param("name") String name);
}
